package com.viettel.menu;

import java.util.Locale;

import com.viettel.rmsmobile.MainActivity;
import com.viettel.rmsmobile.R;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;

public class PlanetFragment extends Fragment {

	public static final String ARG_POSITION = "position_menu";

	public PlanetFragment() {
		// Empty constructor required for fragment subclasses
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_planet, container,
				false);
		int i = getArguments().getInt(ARG_POSITION);
		if (i > 0) {
			MenuDTO menu = MainActivity.menu_data[i - 1];
			String planet = menu.getMenuName();
			int imageId = getResources().getIdentifier(
					planet.toLowerCase(Locale.getDefault()), "drawable",
					getActivity().getPackageName());
			((EditText) rootView.findViewById(R.id.txtPlanetName))
					.setText(planet);
			getActivity().setTitle(planet);
		}

		return rootView;
	}
}
